package io.renren.wh.channel.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.wh.channel.entity.ChannelSettlementEntity;
import io.renren.wh.channel.service.ChannelSettlementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;




/**
 * 
 *
 * @author 夏沫止水
 * @email HeJieLin@gulimall.com
 * @date 2020-07-21 16:48:41
 */
@RestController
@RequestMapping("wh/channelsettlement")
public class ChannelSettlementController {
    @Autowired
    private ChannelSettlementService channelSettlementService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions(":channelsettlement:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = channelSettlementService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions(":channelsettlement:info")
    public R info(@PathVariable("id") Integer id){
		ChannelSettlementEntity channelSettlement = channelSettlementService.getById(id);

        return R.ok().put("channelSettlement", channelSettlement);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions(":channelsettlement:save")
    public R save(@RequestBody ChannelSettlementEntity channelSettlement){
		channelSettlementService.save(channelSettlement);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions(":channelsettlement:update")
    public R update(@RequestBody ChannelSettlementEntity channelSettlement){
		channelSettlementService.updateById(channelSettlement);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions(":channelsettlement:delete")
    public R delete(@RequestBody Integer[] ids){
		channelSettlementService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
